Format Rec. Bolus with the pump's bolus increment#700
Open
bjorkert wants to merge 2 commits into
Open
Conversation
The Loop device status parser formatted Rec. Bolus with a hardcoded String(format: "%.2fU"), while the OpenAPS/Trio parser routed the value through InsulinMetric. The same recommendation rendered as "0.00U" on a Loop URL and "0" on a Trio URL. Use InsulinMetric on both paths.
Rec. Bolus was formatted two different ways: the Loop parser used a hardcoded String(format: "%.2fU"), while the OpenAPS/Trio parser went through InsulinMetric, which drops to one fraction digit below 10 U. The same recommendation rendered as "0.00U" on a Loop URL and "0" on a Trio URL. Both parsers now use InsulinFormatter, which derives its fraction digits from the pump's reported bolusIncrement, so the value is shown at the precision the pump can actually deliver. The unit suffix is dropped to match the other insulin rows in the info table. Clear the info row and deviceRecBolus when the device status carries no recommendation, so a stale value can't linger in the info table, the Rec. Bolus alarm condition, or the Live Activity.
bjorkert
added a commit
that referenced
this pull request
Jul 9, 2026
Rec. Bolus was formatted two different ways: the Loop parser used a hardcoded String(format: "%.2fU"), while the OpenAPS/Trio parser went through InsulinMetric, which drops to one fraction digit below 10 U. The same recommendation rendered as "0.00U" on a Loop URL and "0" on a Trio URL. Both parsers now use InsulinFormatter, which derives its fraction digits from the pump's reported bolusIncrement, so the value is shown at the precision the pump can actually deliver. The unit suffix is dropped to match the other insulin rows in the info table. Clear the info row and deviceRecBolus when the device status carries no recommendation, so a stale value can't linger in the info table, the Rec. Bolus alarm condition, or the Live Activity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rec. Bolus was formatted two different ways. The Loop device status parser used a hardcoded
String(format: "%.2fU"), while the OpenAPS/Trio parser went throughInsulinMetric, which drops to one fraction digit below 10 U. The same recommendation rendered as0.00Uin the info table on a Loop URL and0on a Trio URL.Both parsers now use
InsulinFormatter, which derives its fraction digits from the pump's reportedbolusIncrement, so Rec. Bolus is shown at the precision the pump can actually deliver — two decimals for a 0.05 U DASH pod. The unit suffix is dropped to match the other insulin rows in the info table.When the device status carries no recommendation, the info row and
deviceRecBolusare now cleared. Previously the Loop parser left both stale, so an old recommendation could linger in the info table, the Rec. Bolus alarm condition, and the Live Activity.